// Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   CMIStudentData.java

package com.iphaeton.lms.course.scorm12.datamodel.cmi;

import com.iphaeton.lms.course.scorm12.DebugIndicator;
import com.iphaeton.lms.course.scorm12.datamodel.Element;
import java.io.PrintStream;
import java.io.Serializable;

// Referenced classes of package com.iphaeton.lms.course.scorm12.datamodel.cmi:
//            CMICategory, CMIRequest, DMErrorManager

public class CMIStudentData extends CMICategory
    implements Serializable
{

    public CMIStudentData()
    {
        super(true);
        mastery_score = new Element("", "checkDecimal", "NULL", false, true, false);
        max_time_allowed = new Element("", "checkTimespan", "NULL", false, true, false);
        time_limit_action = new Element("", "checkVocabulary", "TimeLimitAction", false, true, false);
    }

    public Element getMasteryScore()
    {
        return mastery_score;
    }

    public Element getMaxTimeAllowed()
    {
        return max_time_allowed;
    }

    public Element getTimeLimitAction()
    {
        return time_limit_action;
    }

    public void setMasteryScore(String inMasteryScore)
    {
        mastery_score.setValue(inMasteryScore);
    }

    public void setMaxTimeAllowed(String inMaxTimeAllowed)
    {
        max_time_allowed.setValue(inMaxTimeAllowed);
    }

    public void setTimeLimitAction(String inTimeLimitAction)
    {
        time_limit_action.setValue(inTimeLimitAction);
    }

    public String performGet(CMIRequest theRequest, DMErrorManager dmErrorMgr)
    {
        String result = new String("");
        String token = theRequest.getNextToken();
        if(theRequest.hasMoreTokensToProcess())
        {
            if(_Debug)
            {
                System.out.println("Error - Data Model Element not implemented");
                System.out.println("Element being processed: " + token + "is not a valid element of the CMI Student Data\n" + "Data Model Category");
            }
            if(theRequest.isAKeywordRequest())
                dmErrorMgr.recGetKeyWordError(theRequest.getElement());
            else
                dmErrorMgr.recNotImplementedError(theRequest);
        } else
        if(theRequest.isAChildrenRequest())
            result = getChildren();
        else
            result = determineElementValue(this, token, dmErrorMgr);
        return result;
    }

    public String getChildren()
    {
        String children = "mastery_score,max_time_allowed,time_limit_action";
        return children;
    }

    public void performSet(CMIRequest theRequest, DMErrorManager dmErrorMgr)
    {
        String token = theRequest.getNextToken();
        if(theRequest.hasMoreTokensToProcess())
        {
            if(_Debug)
            {
                System.out.println("Error - Data Model Element not implemented");
                System.out.println("Element being processed: " + token + "is not a valid element of the CMI Score\n" + "Data Model Category");
            }
            dmErrorMgr.recNotImplementedError(theRequest);
        } else
        {
            String value = theRequest.getValue();
            if(!theRequest.isAKeywordRequest())
            {
                doSet(this, token, value, dmErrorMgr);
            } else
            {
                if(_Debug)
                {
                    System.out.println("Error - Cannot Set Data Model Element");
                    System.out.println("Element being processed: " + token + "cannot be set\n");
                }
                dmErrorMgr.recKeyWordError(token);
            }
        }
    }

    private boolean isValidStudDataRequest(CMIRequest theRequest)
    {
        boolean rtrnFlag = false;
        if(theRequest.isForASetRequest())
        {
            if(theRequest.getTotalNumTokens() - 1 >= CMISTUD_DATA_MIN_NUM_TOKENS)
                rtrnFlag = true;
        } else
        if(theRequest.getTotalNumTokens() >= CMISTUD_DATA_MIN_NUM_TOKENS)
            rtrnFlag = true;
        return rtrnFlag;
    }

    private static final long serialVersionUID = 0x28c77e35beeb987L;
    private static boolean _Debug;
    public Element mastery_score;
    public Element max_time_allowed;
    public Element time_limit_action;
    private static int CMISTUD_DATA_MIN_NUM_TOKENS = 3;

    static 
    {
        _Debug = DebugIndicator.ON;
    }
}
